#include "MyTime.h"

#if defined(__linux__) || defined(__unix)
#include <time.h>
long long getCurrentTimeSec(){
    struct timespec currentTime;
    clock_gettime(CLOCK_REALTIME, &currentTime);
    return (long long)currentTime.tv_sec;
}
long long getCurrentTimeNsec(){
    struct timespec currentTime;
    clock_gettime(CLOCK_REALTIME, &currentTime);
    return (long long)currentTime.tv_nsec;
}
#endif

#ifdef _WIN32
#include <time.h>
#include <Windows.h>
long long getCurrentTimeSec(){
    time_t currentTimeSec;
    time(&currentTimeSec);
    return (long long)currentTimeSec;
}
long long getCurrentTimeNsec(){
    time_t tt;
    time(&tt);
    SYSTEMTIME winTime;
    GetSystemTime(&winTime);
    return (long long)((long long)tt * 1000 + winTime.wMilliseconds);
}
#endif
